package com.samphanie.ane.library.log;

import java.text.SimpleDateFormat;
import java.util.Locale;

import lombok.Data;

/**
 * @author ZSY
 */
@Data
public class AneLogMo {

    private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA);

    public long timeMills;
    public int level;
    public String tag;
    public String log;

    public AneLogMo(long timeMillis, int level, String tag, String log) {
        this.timeMills = timeMillis;
        this.level = level;
        this.tag = tag;
        this.log = log;
    }

    public String flattenedLog() {
        return getFlattened() + "\n" + log;
    }

    public String getFlattened() {
        return format(timeMills) + '|' + '|' + tag + "|:";
    }

    private String format(long timeMills) {
        return sdf.format(timeMills);
    }

}
